// 进出管理

import localforage from "localforage"
localforage.config({
  // driver: [localforage.INDEXEDDB],
  name: 'INDEXDB',
  version: "1.0"
})
let type = "Statistics"
async function createData() {
  let workers = await localforage.getItem("worker") || new Map()
  return localforage.setItem("Statistics", workers)
}
createData()
export default {

  /**
   * state 状态 0 所有 1 正在上班 2 以下班
   * outDay 多日未出勤
   * inDay 多日为下班
   * corpID 参建单位
   * teamID 全部班组
   * workerName 人名查询
   */
  async query({ workerName }) {
    let workers = await localforage.getItem(type) || new Map()
    let data = [...workers.values()].filter(item => item.workerName.includes(workerName))
    return data
  },
}